<!DOCTYPE html>
<title>Activate a prerendered page from iframe via window.parent.location</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<script>

promise_test(async t => {
  const channel = new BroadcastChannel('result-channel');
  const messageQueue = new BroadcastMessageQueue(channel);
  t.add_cleanup(_ => channel.close());

  const url = `resources/activate-from-iframe.html?mode=triggering`;
  window.open(url, '_blank', 'noopener');

  const gotActivationMessage = await messageQueue.nextMessage();
  assert_equals(gotActivationMessage,
      'attempting prerender activation');
  const gotReloadMessage = await messageQueue.nextMessage();
  assert_equals(gotReloadMessage, 'loaded from scratch');
}, `Navigation on the main frame initiated by window opened by an ` +
    `iframe opening via window.parent.location should not activate a ` +
    `prerendered page`);

</script>
